#ifndef SERIALRCON_H_
#define SERIALRCON_H_

#include "RCon.h"

namespace lagniappe
{

class ProcElement;

const unsigned int SERIAL_BUFF_SIZE = 800;
const unsigned int OP_NAME_SIZE = 16;
const unsigned int PORT_NAME_SIZE = 16;

class SerialRCon : public lagniappe::RCon
{
protected:
	char serialBuffer[SERIAL_BUFF_SIZE];
	char opName[OP_NAME_SIZE];
	char portName[PORT_NAME_SIZE];
	unsigned long refinedDataSize;
public:
	SerialRCon();
	SerialRCon(RCon * src);
	SerialRCon(SerialRCon * src);
	virtual ~SerialRCon();
	virtual inline bool isNative() {return false;}
	RCon * produceNativeRCon(ProcElement * proc);
};

}

/*
 * Basically... the processor will check to see if the RCon it just pulled is native.
 * If it is, continue as normal. If it is not, then a translation must be done.
 * The SerialRCon class will have a method to automatically generate a native RCon.
 * It will take a pointer to the processor. This will be used to look up the pointer
 * to the operator on that processor group (i.e. machine). The port will be copied directly
 * as it is always a std::string. The RData is where things get tricky. The RData had to be
 * copied into the SerialRCon before transmission, and now we have to get it back out.
 * Create a new char array of size dataSize. Do a memcpy from the SerialRCon to the new
 * memory chunk. Set the address of this new chunk as the RData pointer in the new native
 * RCon. Now upon return the processor has a new native RCon and a SerialRCon that it can
 * safely delete.
 *  
 */
#endif /*SERIALRCON_H_*/
